package com.hnevc.xiaoming.httpactivity;

import android.content.Intent;
import android.content.IntentSender;
import android.os.Bundle;
import android.view.View;
import android.webkit.DownloadListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.hnevc.xiaoming.R;

public class MyNewsContentActivity extends AppCompatActivity {

    private ImageView back;
    private TextView title_view;
    private WebView wbv_content;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_news_content);
        initView();
        initData();
        initEvent();
    }

    private void initEvent() {


    }

    private void initData() {

        Intent intent = getIntent();
        String url = intent.getStringExtra("content");
        Toast.makeText(this, ""+url, Toast.LENGTH_SHORT).show();
        wbv_content.loadUrl(url);
        WebSettings settings = wbv_content.getSettings();
        settings.setUseWideViewPort(true); //将图片调整到适合webview的大小
        settings.setLoadWithOverviewMode(true); // 缩放至屏幕的大小
        settings.setSupportZoom(true); //支持缩放，默认为true。是下面那个的前提。
        settings.setBuiltInZoomControls(true); //设置内置的缩放控件。若为false，则该WebView不可缩放
//        settings.setDisplayZoomControls(false); //隐藏原生的缩放控件

    }

    private void initView() {
        back = (ImageView) findViewById(R.id.back);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        title_view = (TextView) findViewById(R.id.title_view);
        title_view.setText("新闻详情页");
        wbv_content = (WebView) findViewById(R.id.wbv_content);
    }
}